import { Component, OnInit, Input } from '@angular/core'

@Component({
  selector: 'cp-rate',
  templateUrl: './rate.component.html',
  styleUrls: ['./rate.component.scss']
})
export class RateComponent implements OnInit {
  @Input() score: number
  on = []
  off = []
  constructor() {}

  ngOnInit() {
    if (this.score > 0 && this.score <= 5) {
      for (let i = 0; i < this.score; i++) {
        this.on.push('on')
      }
      for (let j = 0; j < 5 - this.score; j++) {
        this.off.push('off')
      }
    }
  }
}
